﻿<ResourceDictionary
	xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
	xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
    xmlns:PresentationLayer="clr-namespace:DotBeer.UI.WPFClient" 
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
    mc:Ignorable="d">
    <!-- Resource dictionary entries should be defined here. -->
	<VisualBrush x:Key="Arrow">
        <VisualBrush.Visual>
            <Canvas Width="Auto" Height="Auto">
                <Path Stroke="#FF000000" StrokeThickness="1" Data="M 0 4 L 8 4 L 4 0 Z"/>
            </Canvas>
        </VisualBrush.Visual>
    </VisualBrush>
    
    <Style x:Key="NumericUpDownStyle" TargetType="{x:Type PresentationLayer:NumericUpDown}">
        <Setter Property="BorderBrush" Value="#FF7F9DB9"/>
        <Setter Property="BorderThickness" Value="1,1,1,1"/>
        <Setter Property="Padding" Value="0,0,0,0"/>
        <Setter Property="MinWidth" Value="47"/>
        <Setter Property="HorizontalAlignment" Value="Center"/>
        <Setter Property="VerticalAlignment" Value="Center"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type PresentationLayer:NumericUpDown}">
                    <Border BorderThickness="2,2,2,2" CornerRadius="5,5,5,5" Padding="{TemplateBinding Padding}" Height="Auto">
                        <Grid>
                            <Grid.RowDefinitions>
                                <RowDefinition Height="Auto"/>
                                <RowDefinition Height="Auto"/>
                            </Grid.RowDefinitions>
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition/>
                                <ColumnDefinition Width="Auto"/>
                            </Grid.ColumnDefinitions>
                            <TextBlock Margin="2,0,5,2" VerticalAlignment="Center" Grid.RowSpan="2" Text="{TemplateBinding ValueString}" TextAlignment="Right"/>
                            <RepeatButton Grid.Column="1" Grid.Row="0" Command="PresentationLayer:NumericUpDown.IncreaseCommand" Width="20" Height="13" x:Name="RepeatUp" Style="{DynamicResource RepeatButtonStyle}" Margin="3,3,3,3">
                                <Viewbox Stretch="Fill" Width="10" Height="8" VerticalAlignment="Center" HorizontalAlignment="Center">
                                    <Rectangle Fill="{DynamicResource Arrow}" Width="6" Height="13"/>
                                </Viewbox>
                            </RepeatButton>
                            <RepeatButton HorizontalAlignment="Left" Grid.Column="1" Grid.Row="1" Command="PresentationLayer:NumericUpDown.DecreaseCommand" Width="20" Height="13" x:Name="RepeatDown" Style="{DynamicResource RepeatButtonStyle}" RenderTransformOrigin="0.5,0.5" Margin="3,3,3,3">
                                <RepeatButton.Content>
                                    <Viewbox Stretch="Fill" Width="10" Height="8" VerticalAlignment="Center" HorizontalAlignment="Center">
                                        <Rectangle Fill="{DynamicResource Arrow}" Width="6" Height="13"/>
                                    </Viewbox>
                                </RepeatButton.Content>
                            	<RepeatButton.RenderTransform>
                            		<TransformGroup>
                            			<ScaleTransform ScaleX="1" ScaleY="-1"/>
                            			<SkewTransform AngleX="0" AngleY="0"/>
                            			<RotateTransform Angle="0"/>
                            			<TranslateTransform X="0" Y="0"/>
                            		</TransformGroup>
                            	</RepeatButton.RenderTransform>
                            </RepeatButton>
                        </Grid>
                    </Border>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
</ResourceDictionary>